#include "questwidget.h"
#include "ui_questwidget.h"
#include"QErrorMessage"
Questwidget::Questwidget(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Questwidget)
{
    ui->setupUi(this);
    this->setWindowTitle("查询交通信息");
    ui->comboBox_which->addItem(("请选择交通策略"));
    ui->comboBox_which->addItem("最快到达");
    ui->comboBox_which->addItem("最省钱到达");
    ui->comboBox_type->addItem("列车");
    ui->comboBox_type->addItem("飞机");
}

Questwidget::~Questwidget()
{
    delete ui;
}

void Questwidget::on_pushButton_2_clicked()//取消按钮
{
    s=0;
    this->close();
}

void Questwidget::on_pushButton_clicked()//确定按钮
{
    if(ui->lineEdit_BG->text().isEmpty()||ui->lineEdit_LT->text().isEmpty()){
        QErrorMessage *dlg=new QErrorMessage(this);
        dlg->setWindowTitle("错误信息");
        dlg->showMessage("请将上述信息填写完整！");
        return;
    }
    begin=ui->lineEdit_BG->text();
    last=ui->lineEdit_LT->text();
    s=ui->comboBox_which->currentIndex();
    type=ui->comboBox_type->currentIndex();
    this->close();
}
